package com.kapcb.statemachine;

import com.kapcb.statemachine.impl.TransitionType;

import java.util.Collection;
import java.util.List;

/**
 * <a>Title: State </a>
 * <a>Author: Kapcb <a>
 * <a>Description: State <a>
 *
 * @author Kapcb
 * @version 1.0
 * @date 2024/7/13 22:14
 * @since 1.0
 */
public interface State<S, E, C> extends Visitable {

    /**
     * Gets the state identifier.
     *
     * @return the state identifiers
     */
    S getId();

    /**
     * Add transition to the state
     *
     * @param event  the event of the Transition
     * @param target the target of the transition
     * @return
     */
    Transition<S, E, C> addTransition(E event, State<S, E, C> target, TransitionType transitionType);

    /**
     * Add transitions to the state
     *
     * @param event  the event of the Transition
     * @param target the target of the transitions
     * @return
     */
    List<Transition<S, E, C>> addTransitions(E event, List<State<S, E, C>> targets, TransitionType transitionType);

    /**
     * get transitions by event
     *
     * @param event  the event of the Transition
     * @return
     */
    List<Transition<S, E, C>> getEventTransitions(E event);

    /**
     * get transitions
     *
     * @return
     */
    Collection<Transition<S, E, C>> getAllTransitions();

}
